(function(root, factory) {
    if (typeof define == "function" && define.amd)
        define(["util", "listener"], factory);
    else
        factory();
})(this, function(util, listener) {
    this.legendofkage = this.legendofkage || {};
    if (util && listener) {
        this.legendofkage.Listener = listener;
        this.legendofkage.Util = util;
    }
    var idCounter = 0;

    //抽象基类
    function BaseTrack() {
        BaseTrack.__super__ && BaseTrack.__super__.constructor.apply(this, arguments);
        var id;
        this.getId = function() {
            return id || (id = p.getId());
        }

        //获取轨迹播放数据
        this.getTrackData = function() {
            throw new Error("请在子类中实现该方法");
        }
    }

    legendofkage.Util.inherits(BaseTrack, legendofkage.Listener);

    var p = BaseTrack.prototype;

    //获取轨迹id(唯一标识符)
    p.getId = function() {
        return ++idCounter;
    }

    //轨迹当前状态
    p.getState = function() {
        throw new Error("请在子类中实现该方法");
    }

    //设置播放速度
    p.setPlaySpeed = function(speed) {
        throw new Error("请在子类中实现该方法");
    }

    //开始绘制轨迹
    p.run = function() {
        throw new Error("请在子类中实现该方法");
    }

    //暂停绘制轨迹
    p.pause = function() {
        throw new Error("请在子类中实现该方法");
    }

    //停止绘制轨迹
    p.stop = function() {
        throw new Error("请在子类中实现该方法");
    }

    //清除轨迹资源
    p.dispose = function() {
        throw new Error("请在子类中实现该方法");
    }

    legendofkage.BaseTrack = BaseTrack;
    legendofkage.BaseTrack.resetId = function() {
        idCounter = 0;
    }
    return legendofkage.BaseTrack;
});